<template>
   <Card style="margin-bottom: 10px;">
      <Form ref="saveFrom" :label-width="120">
        <FormItem prop="item.memo" :label="item.title" v-for="(item,index) in dataList" :key="index">
          <Input v-model="item.content" :placeholder="item.title"  style="width: 200px"></Input>
          &nbsp;<Button type="primary"  @click="save(item)">保存</Button>
        </FormItem>

        <FormItem>
          发放奖励&nbsp;&nbsp;&nbsp;&nbsp;<Button type="primary"  @click="orderPriceJob()">执行</Button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          用户升级&nbsp;&nbsp;&nbsp;&nbsp;<Button type="primary"  @click="userLeveUp()">执行</Button>
        </FormItem>

      </Form>
	</Card>
</template>

<script>
	import {list,save,orderPriceJob,userLeveUp} from '@/api/manager/sysSetting';
	export default {

		data() {
			return {
        dataList:[],

			};
		},
		mounted: function() {
      this.getData();
		},
		computed: {
		},
		methods: {
      getData(){
        list(this.searchFrom)
          .then(response => {
            const data = response.data;
            this.dataList = data.data.entityList;
          })
          .catch(error => {});
      },
			save(item) {
				let entity = item;
				setTimeout(() => {
					this.$nextTick(() => {
            save(entity).then(response => {
              this.getData();
              this.$Message.success(this.$t('messageTip.saveSuccess'));
            }).catch(error => {
              this.$Message.error(this.$t('messageTip.frontError'));
            });
					});
				}, 500);
			},
      orderPriceJob() {
      	setTimeout(() => {
            orderPriceJob().then(response => {
              this.$Message.success("执行成功");
            })
            .catch(error => {
              this.$Message.error(this.$t('messageTip.frontError'));
            });
      	}, 500);
      },
      userLeveUp() {
      	setTimeout(() => {
            userLeveUp().then(response => {
              this.$Message.success("执行成功");
            })
            .catch(error => {
              this.$Message.error(this.$t('messageTip.frontError'));
            });
      	}, 500);
      },
		}
	};
</script>
